home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0029_TMemo Text Lines.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-11-22  |  675 b   |  23 lines

  1.  
  2. The correct usage of TMemo.Lines.GetText() (or any other TString's GetText()
  3. method) is as follows:
  4.  
  5.   var
  6.     lpVar : PChar;
  7.   begin
  8.     lpVar := Memo.Lines.GetText;
  9.     try
  10.       {do whatever you like with/to lpVar's contents}
  11.     finally
  12.       StrDispose(lpVar);
  13.     end;
  14.   end;
  15.  
  16. The GetText method creates a copy of the text in Memo.Lines (or other
  17. TStrings object) via the StrAlloc() function.  It is entirely up to
  18. you, the programmer, to dispose of the PChar when you are done via
  19. the StrDispose() function.  Since GetText returns a copy of the
  20. text, you can muck about with its contents as you please without
  21. modifying the text in the TMemo.
  22.  
  23.